InĀ [6]:
import importlib
import src.plots
importlib.reload(src.plots)
Out[6]:
<module 'src.plots' from '/Users/milenaangelova/git-repo/FedCluLearn/src/plots.py'>
InĀ [7]:
from src.plots import plot_plotly, preprocessing_results, plot_plotly_real
InĀ [8]:
local_FedCluLearn = 'results/results_FedCluLearn_2025-02-25 09:52:06.632308.txt'
global_FedCluLearn = 'results/global_model_evaluation_FedCluLearn_2025-02-25 09:52:06.632308.txt'
local_FedCluLearn = 'results/results_FedCluLearn_2025-02-25 10:46:05.736246.txt'
global_FedCluLearn = 'results/global_model_evaluation_FedCluLearn_2025-02-25 10:46:05.736246.txt'
local_FedAvg = 'results/results_FedAvg_2025-02-25 10:41:23.649440.txt'
global_FedAvg = 'results/global_model_evaluation_FedAvg_2025-02-25 10:41:23.649440.txt'
local_FedAtt = 'results/results_FedAtt_2025-02-25 10:46:18.152654.txt'
global_FedAtt = 'results/global_model_evaluation_FedAtt_2025-02-25 10:46:18.152654.txt'
local_FedProx = 'results/results_FedProx_2025-02-25 10:46:26.787383.txt'
global_FedProx = 'results/global_model_evaluation_FedProx_2025-02-25 10:46:26.787383.txt'
local_FedCluLearn_recent = 'results/results_FedCluLearn_2025-02-25 10:54:24.530009.txt'
global_FedCluLearn_recent = 'results/global_model_evaluation_FedCluLearn_2025-02-25 10:54:24.530009.txt'
local_FedCluLearn_Prox_recent = 'results/results_FedCluLearn_Prox_2025-02-25 10:59:22.761987.txt'
global_FedCluLearn_Prox_recent = 'results/global_model_evaluation_FedCluLearn_Prox_2025-02-25 10:59:22.761987.txt'
local_FedCluLearn_Prox = 'results/results_FedCluLearn_Prox_2025-02-25 10:59:52.753193.txt'
global_FedCluLearn_Prox = 'results/global_model_evaluation_FedCluLearn_Prox_2025-02-25 10:59:52.753193.txt'
local_FedCluLearn_percentage = 'results/results_FedCluLearn_2025-02-25 11:11:35.154727.txt'
global_FedCluLearn_percentage = 'results/global_model_evaluation_FedCluLearn_2025-02-25 11:11:35.154727.txt'
local_FedCluLearn_Prox_percentage = 'results/results_FedCluLearn_Prox_2025-02-25 11:11:59.005370.txt'
global_FedCluLearn_Prox_percentage = 'results/global_model_evaluation_FedCluLearn_Prox_2025-02-25 11:11:59.005370.txt'
local_FedCluLearn_percentage_25 = 'results/results_FedCluLearn_percentage_2025-03-03 15:00:50.321053.txt'
global_FedCluLearn_percentage_25 = 'results/global_model_evaluation_FedCluLearn_percentage_2025-03-03 15:00:50.321053.txt'
local_FedCluLearn_Prox_percentage_25 = 'results/results_FedCluLearn_Prox_percentage_2025-03-03 15:01:00.960897.txt'
global_FedCluLearn_Prox_percentage_25 = 'results/global_model_evaluation_FedCluLearn_Prox_percentage_2025-03-03 15:01:00.960897.txt'
local_FedCluLearn_percentage_75 = 'results/results_FedCluLearn_percentage_2025-03-03 15:01:21.724734.txt'
global_FedCluLearn_percentage_75 = 'results/global_model_evaluation_FedCluLearn_percentage_2025-03-03 15:01:21.724734.txt'
local_FedCluLearn_Prox_percentage_75 = 'results/results_FedCluLearn_Prox_percentage_2025-03-03 15:01:32.557997.txt'
global_FedCluLearn_Prox_percentage_75 = 'results/global_model_evaluation_FedCluLearn_Prox_percentage_2025-03-03 15:01:32.557997.txt'
InĀ [9]:
local_filenames = [local_FedCluLearn, local_FedAvg, local_FedAtt, local_FedProx, local_FedCluLearn_Prox]
global_filenames = [global_FedCluLearn, global_FedAvg, global_FedAtt, global_FedProx, global_FedCluLearn_Prox]
InĀ [10]:
mse_column = 'mse'
n_rounds, y = preprocessing_results(filenames=local_filenames, mse_column=mse_column)
plot_plotly(n_rounds, y, title='Avg MSE Local models', y_axis_title=f'{mse_column.upper()} error', y_axis_max=0.3)
InĀ [11]:
for client_id in [0,1,2]:
n_rounds, y = preprocessing_results(filenames=local_filenames, client_id=client_id, mse_column='mse')
plot_plotly(n_rounds, y, title=f'MSE Local model Client {client_id}', y_axis_title='MSE error')
InĀ [12]:
mse_column = 'mse'
# n_rounds, y = preprocessing_results(filenames=[global_FedCluLearn, global_FedCluLearn_recent, global_FedCluLearn_percentage, global_FedAvg, global_FedAtt, global_FedProx, global_FedCluLearn_Prox, global_FedCluLearn_Prox_recent, None], mse_column=mse_column)
# global_filenames = [global_FedCluLearn, global_FedAvg, global_FedAtt, global_FedProx, global_FedCluLearn_Prox]
global_filenames = [global_FedCluLearn, global_FedAvg, global_FedAtt, global_FedProx, global_FedCluLearn_Prox]
n_rounds, y = preprocessing_results(filenames=global_filenames, mse_column=mse_column)
#Avg {mse_column.upper()} Global model
plot_plotly(n_rounds, y, title=f'Global model', y_axis_title=f'{mse_column.upper()}', y_axis_max=1)
InĀ [13]:
mse_column = 'r2'
global_filenames = [global_FedCluLearn, global_FedAvg, global_FedAtt, global_FedProx, global_FedCluLearn_Prox]
n_rounds, y = preprocessing_results(filenames=global_filenames, mse_column=mse_column)
plot_plotly(n_rounds, y, title=f'Global model', y_axis_title=f'{mse_column.upper()}', y_axis_max=1)
InĀ [14]:
mse_column='mse'
for client_id in [0,1,2]:
n_rounds, y = preprocessing_results(filenames=global_filenames, client_id=client_id,mse_column=mse_column)
plot_plotly(n_rounds, y, title=f'Global model - test data Client {client_id}', y_axis_title=f'{mse_column} error')
InĀ [15]:
mse_column='r2'
for client_id in [0,1,2]:
n_rounds, y = preprocessing_results(filenames=global_filenames, client_id=client_id,mse_column=mse_column)
plot_plotly(n_rounds, y, title=f'Global model - test data Client {client_id}', y_axis_title=f'{mse_column} error')
InĀ [16]:
mse_column='mse'
for client_id in [0,1,2]:
n_rounds, y = preprocessing_results(filenames=[local_FedCluLearn, global_FedCluLearn, None, None, None], client_id=client_id,mse_column=mse_column)
plot_plotly(n_rounds, y, title=f'Local vs Global Client {client_id}', y_axis_title=f'{mse_column} error', algo_name1='Local FedCluLearn', algo_name4='Global FedCluLearn')
InĀ [17]:
mse_column = 'mse'
# n_rounds, y = preprocessing_results(filenames=[global_FedCluLearn, global_FedCluLearn_recent, global_FedCluLearn_percentage, global_FedAvg, global_FedAtt, global_FedProx, global_FedCluLearn_Prox, global_FedCluLearn_Prox_recent, None], mse_column=mse_column)
global_filenames = [None, None, global_FedCluLearn_percentage, global_FedAvg, global_FedAtt, global_FedProx, None, None, global_FedCluLearn_Prox_percentage, None, None, None, None]
# global_filenames = [None, None, None, global_FedAvg, global_FedAtt, global_FedProx, None, None, None, global_FedCluLearn_percentage_25, None, global_FedCluLearn_Prox_percentage_25, None]
n_rounds, y = preprocessing_results(filenames=global_filenames, mse_column=mse_column)
plot_plotly_real(n_rounds, y, title=f'', y_axis_title=f'{mse_column.upper()} error', y_axis_max=1, name='real_mse_air_all_5_parts', algo_name3='FedCluLearn-50%', algo_name9='FedCluLearn-Prox-50%') #Avg {mse_column.upper()} Global model
InĀ [18]:
mse_column = 'mse'
# n_rounds, y = preprocessing_results(filenames=[global_FedCluLearn, global_FedCluLearn_recent, global_FedCluLearn_percentage, global_FedAvg, global_FedAtt, global_FedProx, global_FedCluLearn_Prox, global_FedCluLearn_Prox_recent, None], mse_column=mse_column)
global_filenames = [global_FedCluLearn, global_FedCluLearn_recent, global_FedCluLearn_percentage, None, None, None, None, None, None, global_FedCluLearn_percentage_25, global_FedCluLearn_percentage_75, None, None]
n_rounds, y = preprocessing_results(filenames=global_filenames, mse_column=mse_column)
plot_plotly_real(n_rounds, y, title=f'Global model FedCluLearn', y_axis_title=f'{mse_column.upper()} error', y_axis_max=1, name='real_mse_air_fedclulearn_5_parts') # Avg {mse_column.upper()} Global model
InĀ [19]:
mse_column = 'mse'
# n_rounds, y = preprocessing_results(filenames=[global_FedCluLearn, global_FedCluLearn_recent, global_FedCluLearn_percentage, global_FedAvg, global_FedAtt, global_FedProx, global_FedCluLearn_Prox, global_FedCluLearn_Prox_recent, None], mse_column=mse_column)
global_filenames = [None, None, None, None, None, None, global_FedCluLearn_Prox, global_FedCluLearn_Prox_recent, global_FedCluLearn_Prox_percentage, None, None, global_FedCluLearn_Prox_percentage_25, global_FedCluLearn_Prox_percentage_75]
n_rounds, y = preprocessing_results(filenames=global_filenames, mse_column=mse_column)
plot_plotly_real(n_rounds, y, title=f'Global model FedCluLearn-Prox', y_axis_title=f'{mse_column.upper()} error', y_axis_max=1, name='real_mse_air_fedclulearn_prox_5_parts') # Avg {mse_column.upper()} Global model